﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Ex04
{
    public class Computer
    {
        public int ComputerId { get; set; }
        public string Description { get; set; }
        public decimal Price { get; set; }
        public int Ratings { get; set; }
        public string ImageUrl { get; set; }
        public string Memory { get; set; }
        public string CPU { get; set; }
        public string Category { get; set; }

    }
    class Program
    {
        static void Main(string[] args)
        {
            var computers = new List<Computer>
            {
                new Computer
                {
                    ComputerId=1,
                    Description = "戴尔（DELL）台式机 商用办公台式电脑 7040MT i7 16G 1T+ 256固态 主机",
                    Price=5849m,
                    Ratings=6
                },
             
            };
            //找出价格位于2000至3300的计算机
            //1、扩展方法
            var result = computers
                .Where(c=>c.Price>2000m&&c.Price<3300)
                .Select(c=>new {c.Price,c.Description,c.Ratings});


            //2.查询表达式
            var result2 = from computer in computers 
                where computer.Price>2000&&computer.Price<3300
                select new {computer.Price,computer.Description,computer.Ratings};


            Console.ReadKey();
        }
    }
}
